from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.pool import QueuePool

engine = create_engine(
    url='mysql+pymysql://root:qidi930701@192.168.5.14:3306/emby',
    poolclass=QueuePool,
    pool_size=5,
    pool_timeout=60,
    pool_recycle=3600,
    pool_pre_ping=True
)


def get_session():
    return sessionmaker(bind=engine)()


def get_engine():
    return engine
